{php $newUI = true;}
{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li {if $_GPC['do'] == 'membercard'}class="active"{/if}><a href="{php echo $this->createWeburl('membercard', array('op' => 'display'))}">会员卡设置</a></li>
		<li {if $_GPC['do'] == 'signmanage'}class="active"{/if}><a href="{php echo $this->createWeburl('signmanage', array('op' => 'sign_set'))}">签到管理</a></li>
		<li {if $_GPC['do'] == 'noticemanage'}class="active"{/if}><a href="{php echo $this->createWeburl('noticemanage', array('op' => 'notice_list'))}">通知管理</a></li>
		<li {if $_GPC['do'] == 'cardmanage'}class="active"{/if}><a href="{php echo $this->createWeburl('cardmanage', array('op' => 'display'))}">会员卡管理</a></li>
	</ul>
	{if $op == 'post'}
	<div classs="clearfix">
		<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data" id="form1">
			<input type="hidden" name="id" value="{$notice['id']}"/>
			<div class="panel panel-default">
				<div class="panel-heading">发布通知</div>
				<div class="panel-body">
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">标题</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="title" value="{$notice['title']}"/>
							<div class="help-block">不超过30个字符</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">通知图片</label>
						<div class="col-sm-9 col-xs-12">
							{php echo tpl_form_field_image('thumb', $notice['thumb']);}
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">通知会员组</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="groupid" value="0" {if !$notice['groupid']}checked{/if}/> 全部会员
							</label>
							{loop $_W['account']['groups'] $group}
							<label class="radio-inline">
								<input type="radio" name="groupid" value="{$group['groupid']}" {if $notice['groupid'] == $group['groupid']}checked{/if}/> {$group['title']}
							</label>
							{/loop}
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">通知内容</label>
						<div class="col-sm-9 col-xs-12">
							{php echo tpl_ueditor('content', $notice['content']);}
						</div>
					</div>
				</div>
			</div>
			<div class="form-group" style="margin-left:0px">
				<input type="hidden" name="token" value="{$_W['token']}"/>
				<input type="submit" name="submit" value="提交" class="btn btn-primary"/>
			</div>
		</form>
	</div>
	<script>
		$(function(){
			$('#form1').submit(function(){
				if(!$.trim($(':text[name="title"]').val())) {
					util.message('通知标题不能为空', '', 'error');
					return false;
				}
			});
		});
	</script>
	{else if $op == 'notice_list'}
	<div class="clearfix">
		<form action="" method="post" class="form-horizontal" role="form">
			<div class="form-group">
				<div class="col-sm-8 col-lg-9 col-xs-12">
					<a href="{php echo $this->createWeburl('noticemanage', array('op' => 'post'));}" class="btn btn-success"><i class="fa fa-plus"></i> 发布通知</a>
				</div>
			</div>
			<div class="panel panel-default">
				<div class="panel-body table-responsive">
					<table class="table table-hover">
						<thead>
						<tr>
							<th>标题</th>
							<th>通知会员组</th>
							<th>添加时间</th>
							<th class="text-right">操作</th>
						</tr>
						</thead>
						<tbody>
						{loop $notices $notice}
						<tr>
							<td>
								{if !empty($notice['thumb'])}
								<img src="{php echo tomedia($notice['thumb']);}" alt="" width="40" border="1"/>
								{/if}
								{$notice['title']}
							</td>
							<td>
								{if !$notice['groupid']}
								<span class="label label-success">全部会员</span>
								{else}
								<span class="label label-danger">{$_W['account']['groups'][$notice['groupid']]['title']}</span>
								{/if}
							</td>
							<td>{php echo date('Y-m-d H:i', $notice['addtime']);}</td>
							<td class="text-right">
								<a href="{php echo $this->createWeburl('noticemanage', array('op' => 'post', 'id' => $notice['id']));}" class="btn btn-default">编辑</a>
								<a href="{php echo $this->createWeburl('noticemanage', array('op' => 'delete', 'id' => $notice['id']));}" onclick="if(!confirm('确定删除吗')) return false;" class="btn btn-default">删除</a>
							</td>
						</tr>
						{/loop}
						</tbody>
					</table>
				</div>
			</div>
			{$pager}
		</form>
	</div>
	{/if}
</div>
{template 'common/footer'}